package com.example.bcustomer.controller;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 * 消费者监听topic为ABCD的消息
 */
@Component
public class ConsumerController {

    @KafkaListener(topics = "ABCD")
    public void onMessage(ConsumerRecord<?, ?> record){
        //消费后打印出来
        System.out.println("消费了："+record.topic()+"-"+record.partition()+"-"+record.value());

    }

}
